package base.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForward;
import org.apache.struts.actions.DispatchAction;

import biz.dao.BbsAttachmentDao;
import biz.dao.BbsBoardDao;
import biz.dao.BbsPostDao;
import biz.dao.BbsRecordDao;
import biz.dao.BbsUserDao;

public abstract class BaseAction extends DispatchAction
{
	protected BbsAttachmentDao attachmentDao;
	protected BbsBoardDao boardDao;
	protected BbsPostDao postDao;
	protected BbsUserDao userDao;
	protected BbsRecordDao recordDao;

	protected ActionForward forword(String path, HttpServletRequest request, HttpServletResponse response)
	{
		try
		{
			request.getRequestDispatcher(path).forward(request, response);
		}
		catch (Exception e)
		{
			throw new RuntimeException(e);
		}

		return null;
	}

	protected ActionForward sendRedirect(String url, HttpServletResponse response)
	{
		try
		{
			response.sendRedirect(url);
		}
		catch (Exception e)
		{
			throw new RuntimeException(e);
		}

		return null;
	}

	public void setAttachmentDao(BbsAttachmentDao attachmentDao) {
		this.attachmentDao = attachmentDao;
	}

	public void setBoardDao(BbsBoardDao boardDao) {
		this.boardDao = boardDao;
	}

	public void setPostDao(BbsPostDao postDao) {
		this.postDao = postDao;
	}

	public void setUserDao(BbsUserDao userDao) {
		this.userDao = userDao;
	}

	public void setRecordDao(BbsRecordDao recordDao) {
		this.recordDao = recordDao;
	}
	
}
